const CopyWebpackPlugin = require('copy-webpack-plugin')
module.exports = {
    configureWebpack: {
        plugins: [
            new CopyWebpackPlugin([
                {from: '../workflow/public/flowable-modeler', to: 'flowable-modeler'},
                {from: '../workflow/public/flowable-admin', to: 'flowable-admin'},
                {from: '../workflow/public/flowable-task', to: 'flowable-task'},
                {from: '../workflow/public/flowable-ext', to: 'flowable-ext'},
                {
                    from: process.env.VUE_APP_PORTALONEBACKEND == 'true' ? '../workflow/src/flowable-ext/config/flowable-baseurl-backend-one.js':'../workflow/src/flowable-ext/config/flowable-baseurl-backend-mul.js',
                    to: 'flowable-ext/config/flowable-backend-baseurl.js'
                },
                // 这里不需要复制，但也写在这了
                {
                    from: process.env.VUE_APP_PORTALONE == 'true' ? '../workflow/src/flowable-ext/config/flowable-baseurl-frontend-one.js':'../workflow/src/flowable-ext/config/flowable-baseurl-frontend-mul.js',
                    to: 'flowable-ext/config/flowable-frontend-baseurl.js'
                }
            ])
        ]
    },
    devServer: {
        port: 9010,
        proxy: {
            // 接口请求代理，，以防止跨域，api是在axios定义的时候设置的baseUrl参考main.js 中的axios.defaults.baseURL = '/api'
            '/api': {
                target:  'http://localhost:9100',
                pathRewrite:{
                    '^/api':''
                }
            }
        },
        disableHostCheck: true
    }
}